﻿Public Class LoaiXe
    Public Shared Function them(ByVal tenloai As String) As Boolean
        tenloai = EscapeString(tenloai)
        Return db.Query("INSERT INTO LoaiXe(TenLoai) VALUES(N'" + tenloai + "')")
    End Function
    Public Shared Function dslx() As DataTable
        Return db.QueryTable("SELECT * FROM LoaiXe")
    End Function
    Public Shared Function capnhat(ByVal maloai As String, ByVal tenloai As String) As Boolean
        maloai = EscapeString(maloai)
        tenloai = EscapeString(tenloai)
        Return db.Query("UPDATE LoaiXe SET TenLoai = N '" + tenloai + "' WHERE MaLoai = '" + maloai + "'")
    End Function
    Public Shared Function xoa(ByVal maloai As String) As Boolean
        maloai = EscapeString(maloai)
        Return db.Query("DELETE FROM LoaiXe WHERE MaLoai = '" + maloai + "'")
    End Function
    Public Shared Function timkiem(ByVal tukhoa) As DataTable
        tukhoa = EscapeString(tukhoa)
        Return db.QueryTable("SELECT * FROM LoaiXe WHERE MaLoai like '%" + tukhoa + "%' or TenLoai like '%" + tukhoa + "%'")
    End Function

End Class
